package cn.tedu.charging.cost.dao.repository;

import cn.tedu.charging.common.pojo.po.ChargingCostRulePO;
import cn.tedu.charging.cost.dao.mapper.ChargingCostRuleMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class CostRepository {
    @Autowired
    private ChargingCostRuleMapper chargingCostRuleMapper;
    public ChargingCostRulePO getCostRule(Integer stationId,Integer hour){
        QueryWrapper<ChargingCostRulePO> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("station_id",stationId);
        queryWrapper.le("start_time",hour);
        queryWrapper.gt("end_time",hour);
        return chargingCostRuleMapper.selectOne(queryWrapper);
    }
}
